$(function () {
    refresh(null);
});

function refresh(jsonStr){
    if(jsonStr==null){
        return;
    }

    Highcharts.setOptions({
        lang: {
            resetZoom: '重置比例'
        }
    });

    var json = JSON.parse(jsonStr);

    $('#container').highcharts({
        chart: {
            type: 'spline',
            pinchType: 'x',
            spacing: [2, 0, 8, 0]
        },
        title: {
            text: json.title,
            style: {
                fontSize: '16px'
            }
        },
        credits: {
            enabled: false
                },
        legend: {
            enabled: false
        },
        xAxis: {
            categories: json.categories,
            title: {
                enabled: false
            }
        },
        yAxis: {
            title: {
                enabled: false
            }
        },
        tooltip: {
            shared: true
        },
        series: [{
            name: json.seriesName,
            data: json.seriesData
        }]
    });
};